package com.heima.comment.controller.v1;

import com.heima.comment.service.CommentCallBackService;
import com.heima.model.comment.dtos.CommentRepayDTO;
import com.heima.model.comment.dtos.CommentRepayLikeDTO;
import com.heima.model.comment.dtos.CommentRepaySaveDTO;
import com.heima.model.common.dtos.ResponseResult;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/comment_repay")

public class CommentCallBackController {

    @Autowired
    private CommentCallBackService commentCallBackService;

    @ApiOperation("加载回复列表")
    @PostMapping("/load")
    public ResponseResult loadCommentRepay(@RequestBody CommentRepayDTO dto) {
        return commentCallBackService.callBackDisplay(dto);
    }

    @ApiOperation("发表回复评论")
    @PostMapping("/save")
    public ResponseResult saveCommentRepay(@RequestBody CommentRepaySaveDTO dto) {
        return commentCallBackService.callBackSave(dto);
    }

    @ApiOperation("回复点赞")
    @PostMapping("/like")
    public ResponseResult saveCommentRepayLike(
      @RequestBody CommentRepayLikeDTO dto){
      return commentCallBackService.callBackLike(dto);
    }

}